package com.ssy.lingxi.marketing.controller.activity;

import com.ssy.lingxi.common.constant.marketing.ActivityTypeEnum;
import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.marketing.model.constant.MerchantActivityInnerStatusEnum;
import com.ssy.lingxi.marketing.model.vo.activity.request.MerchantActivityPlatformPageVO;
import com.ssy.lingxi.marketing.model.vo.activity.request.PfActivityGoodsPageReq;
import com.ssy.lingxi.marketing.model.vo.activity.response.McActivityGoodsPageResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.MerchantActivityDetailResp;
import com.ssy.lingxi.marketing.model.vo.activity.response.PlatformMerchantActivityPageResp;
import com.ssy.lingxi.marketing.model.vo.common.request.CommonIdReq;
import com.ssy.lingxi.marketing.model.vo.common.response.PageItemVO;
import com.ssy.lingxi.marketing.service.ICommonService;
import com.ssy.lingxi.marketing.service.IPlatformMerchantActivityService;
import com.ssy.lingxi.marketing.serviceimpl.base.activity.BaseActivityRecordService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 平台后台 - 商家营销活动管理
 * @author yzc
 * @version 2.0.0
 * @date 2021/8/24
 */
@RestController
@RequestMapping("/marketing/platform/merchant/activity")
public class PlatformMerchantActivityController extends BaseController {


    @Resource
    private IPlatformMerchantActivityService merchantActivityService;
    @Resource
    private ICommonService commonService;
    @Resource
    private BaseActivityRecordService activityRecordService;

    /**
     * 商家营销活动查询 - 外部状态列表
     *//*
    @RequestMapping(value = "/getOuterStatusList", method = RequestMethod.GET)
    public Wrapper<List<PageItemVO>> getOuterStatusList() {
        return commonService.getStatusList(MerchantActivityOuterStatusEnum.class);
    }

    *//**
     * 商家营销活动查询 - 内部状态列表
     */
    @RequestMapping(value = "/getInnerStatusList", method = RequestMethod.GET)
    public Wrapper<List<PageItemVO>> getStatusList() {
        return commonService.getStatusList(MerchantActivityInnerStatusEnum.class);
    }

    /**
     * 商家营销活动查询 - 活动类型列表
     */
    @RequestMapping(value = "/getActivityTypeList", method = RequestMethod.GET)
    public Wrapper<List<PageItemVO>> getActivityTypeList() {
        return commonService.getStatusList(ActivityTypeEnum.class);
    }

    /**
     * 商家营销活动查询 - 分页列表
     */
    @RequestMapping(value = "/page", method = RequestMethod.GET)
    public Wrapper<PageData<PlatformMerchantActivityPageResp>> pageSummary(HttpServletRequest httpRequest, @Valid MerchantActivityPlatformPageVO pageVO) {
        return merchantActivityService.pageSummary(getPlatformUser(httpRequest), pageVO);
    }

    /**
     * 商家营销活动查询 - 活动详情
     */
    @GetMapping(value = "/detail")
    public Wrapper<MerchantActivityDetailResp> detail(HttpServletRequest httpRequest, CommonIdReq req) {
        return merchantActivityService.detail(getPlatformUser(httpRequest), req);
    }

    /**
     * 商家营销活动查询 - 活动详情 - 活动商品(分页)
     */
    @RequestMapping(value = "/detail/goods/page", method = RequestMethod.GET)
    public Wrapper<PageData<McActivityGoodsPageResp>> activityGoodsPage(HttpServletRequest httpRequest, @Valid PfActivityGoodsPageReq req) {
        return merchantActivityService.pageByActivityGoods(getPlatformUser(httpRequest), req);
    }

    /**
     * 商家营销活动查询 - 活动详情 - 外部流转记录(分页)
     *//*
    @RequestMapping(value = "/outer/record/page", method = RequestMethod.GET)
    public Wrapper<PageData<ActivityOuterRecordResp>> pageOuterRecordList(HttpServletRequest httpRequest, @Valid ActivityOuterRecordPageReq pageVO) {
        return activityRecordService.pagePlatformActivityOuterRecord(getPlatformUser(httpRequest), pageVO);
    }

    *//**
     * 待审核商家营销活动 - 分页列表
     *//*
    @RequestMapping(value = "/page/tobe/exam", method = RequestMethod.GET)
    public Wrapper<PageData<MerchantActivityToBeExamPageResp>> pageByToBeExam(HttpServletRequest httpRequest, @Valid MerchantActivityPlatformPageVO pageVO) {
        return merchantActivityService.pageByToBeExam(getPlatformUser(httpRequest), pageVO);
    }

    *//**
     * 待审核商家营销活动 - 审核
     *//*
    @PostMapping(value = "/examine")
    public Wrapper<Void> examine(HttpServletRequest httpRequest, @RequestBody @Valid ActivityExamineReq req) {
        return merchantActivityService.examine(getPlatformUser(httpRequest), req);
    }

    *//**
     * 待审核商家营销活动 - 批量审核
     *//*
    @PostMapping(value = "/examine/batch")
    public Wrapper<Void> batchExamine(HttpServletRequest httpRequest, @RequestBody @Valid CommonIdsReq req) {
        return merchantActivityService.batchExamine(getPlatformUser(httpRequest), req);
    }*/
}
